#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "uthash.h"

int numWaterBottles(int numBottles, int numExchange);

int main()
{
	return 0;
}

int numWaterBottles(int numBottles, int numExchange)
{
	int empty = numBottles / numExchange, rest_empty = numBottles % numExchange,
		res = numBottles;
	while (empty > 0) {
		res += empty;
		empty += rest_empty;
		rest_empty = empty % numExchange;
		empty /= numExchange;
	}

	return res;
}
